{extend name='table'}

{block name="content"}
<div class="layui-card padding-20 shadow layui-card-body" >
    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-bg-blue"   data-modal='{:url("add")}?customer_id={$customer_id}'  >新增</button>
    </div>
    <table id="CustomerSecondaryCardTable" data-url="{:sysuri()}" data-target-search="form.form-search"></table>
</div>
{/block}
{block name='script'}
<script>
    $(function () {
        // 初始化表格组件
        $('#CustomerSecondaryCardTable').layTable({
            even: true,
            page: false,
            sort: {field: 'id desc', type: 'desc'},
            where:{customer_id: '{$customer_id}'},
            cols: [[
                {title: '序号', type: 'numbers', width: 60},
                {field: 'secondary_card_name', title: '副卡等级', align: "center", minWidth: 170},
                {field: 'power_source_name', title: '绑定的陪玩', align: "center", minWidth: 170},
                {field: 'prestore_amount', title: '预存金额', align: "center"},
                {field: 'use_amount', title: '已用金额', align: "center"},
                {field: 'balance', title: '余额', align: "center",templet:function (d) {
                        return d.prestore_amount-d.use_amount
                    }},
                {toolbar: '#toolbarnaming', title: '操作面板', align: 'center', minWidth: 200, fixed: 'right'},
            ]]

        });



    });

</script>

<!-- 数据操作工具条模板 -->
<script type="text/html" id="toolbarnaming">
    <!--{if auth("edit") }-->
    <a class="layui-btn  layui-btn-sm" data-modal='{:url("edit")}?id={{d.id}}&customer_id={$customer_id}'>编 辑</a>
    <!--{/if}-->
    <!--{if auth("remove")}-->
    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="{:lang('确定要删除吗？')}" data-action="{:url('remove')}" data-value="id#{{d.id}}">{:lang('删 除')}</a>
    <!--{/if}-->

</script>
{/block}
